import unittest,time
from selenium import webdriver
from Page.Page1 import Page1
from Page.Page2 import Page2
from Page.Page3 import Page3
from Tools.Tools import Tools

class TestCase(unittest.TestCase):
    def setUp(self):
        self.driver = webdriver.Firefox()
        Tools().log()

    def tearDown(self):
        self.driver.implicitly_wait(10)
        self.driver.quit()

    def test_01(self):
        try:
            po = Page1(self.driver)
            po.luoji_01()
        except Exception as e:
            t = time.strftime('%Y%m%d%H%M%S')
            self.driver.save_screenshot(t + '.png')
            print(e)

    def test_02(self):
        try:
            po = Page2(self.driver)
            # self.driver.implicitly_wait(10)
            time.sleep(10)
            po.luoji_01()
            po.writer()
            po.person()
            po.title()
            po.kj2()
            po.neir()
            po.iframe_content()
            # print(po.dy2())
            # assert '<15235688537@163.com>' == po.dy2()
            po.send()
        except:
            t = time.strftime('%Y%m%d%H%M%S')
            self.driver.save_screenshot(t + '.png')

    def test_03(self):
        try:
            po = Page3(self.driver)
            po.luoji_01()
            po.luoji_03()
        except Exception as e:
            t = time.strftime('%Y%m%d%H%M%S')
            self.driver.save_screenshot(t + '.png')
            print(e)